<?php
	session_start();
	ob_start();
	date_default_timezone_set('Asia/Ho_Chi_Minh');
	
	include_once "../configuration.php";
	include_once "../classes/thuvienham.php";
	$sc = new SystemConfig();
	
	if(!IsDangNhap())
		header("Location: login.php");
	else
		if(!IsAdmin() && !IsBTV())
			header("Location: ../index.php");
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title><?php echo $sc->TenTrangWeb;?></title>
		<link rel="stylesheet" type="text/css" href="../css/style.css" />
		<script type="text/javascript" src="../js/javascript.js"></script>
		<script src="../js/jquery-1.9.1.js"></script>
		<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
		<script type="text/javascript" src="../ckeditor/sample.js"></script>
		<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
		<script src='../js/jquery.min.js' type='text/javascript'></script>
		<style type="text/css">
			#toppage1k {
				width:100px;
				text-align:center;
				padding:5px;
				position:fixed;
				bottom:10px;right:10px;
				cursor:pointer;
				text-decoration:none;
			}
		</style>
		<link rel="stylesheet" href="../css/jquery-ui.css" />
		<script src="../js/jquery-1.9.1.js"></script>
		<script src="../js/jquery-ui.js"></script>
		<script>
			$(function() {
				$( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
			});
		</script>
		<a href="#" id="toppage1k"><img src='../data/toppage.png' alt='' style='border:0;'/></a>

		<script type='text/javascript'>
			$(function(){
				$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");
				if($(window).scrollTop()!="0")
				{
					$(this).fadeIn("slow")
				}
				var scrollDiv=$(this);
				$(window).scroll(function(){
					if($(window).scrollTop()=="0")
					{
						$(scrollDiv).fadeOut("slow")
					}
					else{$(scrollDiv).fadeIn("slow")}
				});
				$(this).click(function(){
					$("html, body").animate({scrollTop:0},"slow")
				})}
			});
			$(function() {
			$("#toppage1k").scrollToTop();
			});
		</script>
	</head>
	<body>
		<div id="BackgroundAd">
			<div id="TrangWeb">
				<div id="ThongTinAdmin">
					<div class="HomeAndView">
						<a href="index.php">HOME - BACK END</a>
						<a href="../index.php" target="_blank">FRONT END</a>
					</div>
					<form action="../index.php?action=dangxuat_xuly" method="POST">
						<table>
							<tr>
								<td>
									<a href="../index.php?action=trangcanhan">
									<img src="../<?php echo $_SESSION['Avatar'];?>" />
									<p><?php echo $_SESSION['HoTen']; ?></p>
									</a>
								</td>
								<td><input type="submit" value="Đăng xuất" /></td>
							</tr>
						</table>
					</form>
				</div>
				<div id="BannerAdmin">
					
				</div>
				
				<div id="MenuAdmin">
					<ul id="nav">
						<li class="current">Chào <b><?php echo $_SESSION['HoTen']; ?></b>, chúc bạn một ngày vui vẻ!</li>
					</ul>
					<?php
						//Đếm số bình luận và bài viết có mã trạng thái = 0  -->  chưa kiểm duyệt
						include_once "../classes/baiviet_bs.php";
						include_once "../classes/binhluan_bs.php";
						$baiviet = new baiviet_bs();
						$baiviet->SetMaTrangThai(0);
						$data_baiviet = $baiviet->LayDanhSach();
						$SoBaiViet = ($data_baiviet == null) ? 0 : count($data_baiviet);
						
						$binhluan = new binhluan_bs();
						$binhluan->SetMaTrangThai(0); 
						$data_binhluan = $binhluan->LayDanhSach();
						$SoBinhLuan = ($data_binhluan == null) ? 0 : count($data_binhluan);
						if(IsAdmin())
						{
					?>
							<div class="ThongBaoKiemDuyet">
								<a href="index.php?actionad=baiviet_kiemduyet">Kiểm duyệt bài viết <i>[<?php echo $SoBaiViet; ?>]</i></a>
								<a href="index.php?actionad=binhluan_kiemduyet">Kiểm duyệt bình luận <i>[<?php echo $SoBinhLuan; ?>]</i></a>
							</div>
					<?php
						}
					?>
				</div>
				<div id="NoiDungAdmin">
					<div class="BenTrai">
						<?php
							include_once "menu_vertical/quanly_noidung.php";
							if(isset($_SESSION['MaLoaiNguoiDung']) && $_SESSION['MaLoaiNguoiDung'] == 1)
							{
								include_once "menu_vertical/quanly_nguoidung.php";
								include_once "menu_vertical/caidat_hethong.php";
							}
						?>
					</div>
					<div class="BenPhai">
						<?php
							$tmp = isset($_GET['actionad']) ? $_GET['actionad'] : "home";
							include $tmp . ".php";
						?>
					</div>
				</div>
				<div id="FooterAdmin">
						<div class="TopBar">
							<div class="Logo">
							</div>
						</div>
						<div class="Columns">
							<table>
								<tr>
									<th>Thông tin</th>
									<th>Giới thiệu</th>
									<td rowspan="2" align="right" class="none">
										<a href="index.php">
											<img width="100px" src="../data/qrcode.png" />
										</a>
									</td>
								</tr>
								<tr>
									<td>
										<b>Nguyễn Văn Quy</b><br/>
										<b>QUYNV Group &#169; 2013 - 2014</b><br/>
										Chi tiết liên hệ: <i><u><a href="mailto:quynv@hotmail.com">quynv@hotmail.com</a></u></i>
									</td>
									<td>
										- Cập nhật tin tức về bóng đá nhanh nhất<br/>
										- Liên hệ quảng cáo:<br/>
											&emsp;&emsp;+ Phone:<br/>
											&emsp;&emsp;+ Email: <i><u><a href="mailto:quynv@hotmail.com">quynv@hotmail.com</a></u></i><br/>
									</td>
									
								</tr>
							</table>
						</div>
					</div>
			</div>
		</div>
	</body>
</html>
<?php
	ob_end_flush();
?>